import java.io.File;
import java.io.FileReader;
import java.io.BufferedReader;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.*;
import org.apache.tika.Tika;

public class FindFile {
  private static List<File> list;

  public FindFile() {
    list = new ArrayList<File>();
  }

  public static List<File> getFileList() {
    return list;
  }

  public static void main(String[] args) throws Exception {
    File folder = new File(args[0]);
    getFiles(folder);
    System.out.println("list.size = " + list.size());
  }

  public static void getFiles(File folder) throws Exception {
    //folder.setReadOnly();
    File[] files = folder.listFiles();

    for(int j = 0; j < files.length; j++) {
      if(files[j].isDirectory())
        getFiles(files[j]);
      else if (files[j].isFile()) {
        list.add(files[j]);
      }
    }
  }
}

